package com.cloud.cloudvideo.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloud.cloudvideo.entity.SysGroup;
import com.cloud.cloudvideo.mapper.SysGroupMapper;
import com.cloud.cloudvideo.service.GroupService;

@Service
public class GroupServiceImpl implements GroupService {

	
	@Autowired
	private SysGroupMapper groupMapper;
	
	
	@Override
	public List<SysGroup> grouplist() {
		return groupMapper.selectByExample(null);
	}


	@Override
	public void modifyGroup(SysGroup group) {
		if(null == group.getId()) {
			group.setCreateTime(new Date());
			group.setCreateBy(1L);
			groupMapper.insertSelective(group);
		}else {
			groupMapper.updateByPrimaryKeySelective(group);
		}
	}


	@Override
	public void delete(Long id) {
		groupMapper.deleteByPrimaryKey(id);
	}


	@Override
	public SysGroup groupInfo(Integer id) {
		return groupMapper.selectByPrimaryKey(id.longValue());
	}

}
